/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.transaction.SystemException;
import model.DAO.EmpleadoDao;

/**
 *
 * @author Tarde
 */
public class EmpleadoSvc {

    EmpleadoDao employeeDao = new EmpleadoDao();

    public void insertEmployee(EmpleadoBean employee) {
        try {
            employeeDao.createAndStoreEmpleado(employee);
        } catch (IllegalStateException ex) {
            Logger.getLogger(EmpleadoSvc.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SystemException ex) {
            Logger.getLogger(EmpleadoSvc.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public List selectAllEmployees() {
        List empleados = new ArrayList();
        empleados = employeeDao.listAllEmpleados();

        return empleados;
    }

    public void deleteEmployee(EmpleadoBean employee) {
        employeeDao.deleteEmpleados(employee);
    }

    public void updateEmployee(EmpleadoBean employee) {
        employeeDao.updateEmpleados(employee);
    }
}
